]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspaceThumbnail: Handle minimized windows
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 31 May 2011 16:49:36 +0000 (18:49 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 22 Jun 2011 11:10:50 +0000 (13:10 +0200)
Workspace thumbnails are supposed to be miniatures of the "real"
workspace they represent, but currently they show minimized windows
like the window picker.
Instead, hide minimized windows and track changes to update the
thumbnail accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=651569

js/ui/workspaceThumbnail.js

index 8c12e86c0cc4df869aa412ac231ab7c1a8d58de3..97b449fb9aee6ae6997a71bcadcb24f13683d303 100644 (file)
@@ -178,6 +178,11 @@ WorkspaceThumbnail.prototype = {
         // Create clones for windows that should be visible in the Overview
         this._windows = [];
         for (let i = 0; i < windows.length; i++) {
+            windows[i].meta_window._minimizedChangedId =
+                windows[i].meta_window.connect('notify::minimized',
+                                               Lang.bind(this,
+                                                         this._updateMinimized));
+
             if (this._isOverviewWindow(windows[i])) {
                 this._addWindowClone(windows[i]);
             }
@@ -257,11 +262,18 @@ WorkspaceThumbnail.prototype = {
             return;
 
         // Check if window still should be here
-        if (win && this._isMyWindow(win))
+        if (win && this._isMyWindow(win) && this._isOverviewWindow(win))
             return;
 
         let clone = this._windows[index];
         this._windows.splice(index, 1);
+
+        if (win && this._isOverviewWindow(win)) {
+            if (metaWin._minimizedChangedId) {
+                metaWin.disconnect(metaWin._minimizedChangedId);
+                delete metaWin._minimizedChangedId;
+            }
+        }
         clone.destroy();
     },
 
@@ -290,6 +302,11 @@ WorkspaceThumbnail.prototype = {
         if (this._lookupIndex (metaWin) != -1)
             return;
 
+        if (!metaWin._minimizedChangedId)
+            metaWin._minimizedChangedId = metaWin.connect('notify::minimized',
+                                                          Lang.bind(this,
+                                                                    this._updateMinimized));
+
         if (!this._isMyWindow(win) || !this._isOverviewWindow(win))
             return;
 
@@ -316,6 +333,13 @@ WorkspaceThumbnail.prototype = {
         }
     },
 
+    _updateMinimized: function(metaWin) {
+        if (metaWin.minimized)
+            this._doRemoveWindow(metaWin);
+        else
+            this._doAddWindow(metaWin);
+    },
+
     destroy : function() {
         this.actor.destroy();
     },
@@ -326,6 +350,14 @@ WorkspaceThumbnail.prototype = {
         global.screen.disconnect(this._windowEnteredMonitorId);
         global.screen.disconnect(this._windowLeftMonitorId);
 
+        for (let i = 0; i < this._windows.length; i++) {
+            let metaWin = this._windows[i].metaWindow;
+            if (metaWin._minimizedChangedId) {
+                metaWin.disconnect(metaWin._minimizedChangedId);
+                delete metaWin._minimizedChangedId;
+            }
+        }
+
         this._windows = [];
         this.actor = null;
     },
@@ -339,7 +371,8 @@ WorkspaceThumbnail.prototype = {
     // Tests if @win should be shown in the Overview
     _isOverviewWindow : function (win) {
         let tracker = Shell.WindowTracker.get_default();
-        return tracker.is_window_interesting(win.get_meta_window());
+        return tracker.is_window_interesting(win.get_meta_window()) &&
+               win.get_meta_window().showing_on_its_workspace();
     },
 
     // Create a clone of a (non-desktop) window and add it to the window list